package com.example.controller;

import com.example.entity.TShopProduct;
import com.example.service.ITShopProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author llp
 * @since 2025-10-14
 */
@RestController
public class TShopProductController {

    @Autowired
    private ITShopProductService shopProductService;

    @Value("${server.port}")
    private String port;

    @GetMapping("/get/{pid}")
    public TShopProduct get(@PathVariable Long pid){
        TShopProduct product = shopProductService.getById(pid);
        product.setPname(product.getPname() + port);
        return product;
    }

}
